/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package com.stip.server.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author BlueBerry
 */
@Entity
@Table(name = "user_token")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UserToken.findAll", query = "SELECT u FROM UserToken u"),
    @NamedQuery(name = "UserToken.findByAccessTakon", query = "SELECT u FROM UserToken u WHERE u.accessTakon = :accessTakon"),
    @NamedQuery(name = "UserToken.findByUid", query = "SELECT u FROM UserToken u WHERE u.uid = :uid"),
    @NamedQuery(name = "UserToken.findByAccessDate", query = "SELECT u FROM UserToken u WHERE u.accessDate = :accessDate")})
public class UserToken implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 35)
    @Column(name = "access_takon")
    private String accessTakon;
    @Size(max = 15)
    @Column(name = "uid")
    private String uid;
    @Column(name = "access_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date accessDate;

    public UserToken() {
    }

    public UserToken(String accessTakon) {
        this.accessTakon = accessTakon;
    }

    public String getAccessTakon() {
        return accessTakon;
    }

    public void setAccessTakon(String accessTakon) {
        this.accessTakon = accessTakon;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public Date getAccessDate() {
        return accessDate;
    }

    public void setAccessDate(Date accessDate) {
        this.accessDate = accessDate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (accessTakon != null ? accessTakon.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserToken)) {
            return false;
        }
        UserToken other = (UserToken) object;
        if ((this.accessTakon == null && other.accessTakon != null) || (this.accessTakon != null && !this.accessTakon.equals(other.accessTakon))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.stip.server.entities.UserToken[ accessTakon=" + accessTakon + " ]";
    }
    
}
